/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#ifndef WISHMASTER_POSTID_H
#define WISHMASTER_POSTID_H

#include <QString>
#include "misc.h"

namespace Wishmaster
{
	class ThreadId;
	class WISHMASTER_EXPORT PostId
	{
	public:
		explicit PostId();
		explicit PostId(const ThreadId& threadId, unsigned long postId);
		explicit PostId(const QString& chan, const QString& board, unsigned long threadId, unsigned long postId, int attach = 0);
		explicit PostId(const PostId& id, int attach);
		virtual ~PostId();

		QString chan() const;
		QString board() const;
		unsigned long threadId() const;
		unsigned long postId() const;
		int attachIndex() const;

		QString toString() const;

		ThreadId getThreadId() const;

		bool isValid() const;

		bool operator<(const Wishmaster::PostId& id1) const;
		bool operator==(const Wishmaster::PostId& id1) const;
	private:
		QString m_chan;
		QString m_board;
		unsigned long m_threadId;
		unsigned long m_postId;
		int m_attachIndex;

		bool m_valid;
	};
	uint WISHMASTER_EXPORT qHash(const PostId& id);
}

#endif

